﻿using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Flower.Actors.Tests
{
    [TestFixture]
    public class ObjectPoolTest
    {
        [Test]
        public void GetReturnTest()
        {
            var pool = new ObjectPool<object>();
            var objects = new List<object>();
            const int nTests = 100;

            for (int i = 0; i < nTests; i++)
            {
                objects.Add(pool.Get());
            }

            for (int i = 0; i < nTests; i++)
            {
                pool.Return(objects[i]);
            }

            for (int i = 0; i < nTests; i++)
            {
                Assert.Contains(pool.Get(), objects);
            }
        }
    }
}
